﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SimpleListBase.ascx.cs"
    Inherits="Viewer.Base.SimpleListBase" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
    var submitValue = function (grid, hiddenFormat, format) {
        hiddenFormat.setValue(format);
        grid.submitData(false);
    };
</script>
<ext:Hidden ID="FormatType" runat="server" />
<ext:FitLayout ID="FitLayout1" runat="server">
    <Items>
        <ext:GridPanel ID="GrdDetails" runat="server" X="0" Y="0" AnchorHorizontal="100%"
            AnchorVertical="100%" TrackMouseOver="true" StripeRows="true">
            <Store>
                <ext:Store ID="StoMainSource" runat="server" OnSubmitData="StoMainSource_Submit"
                    RemoteSort="true">
                    <Reader>
                        <ext:JsonReader IDProperty="ToChucID" >
                            <Fields>
                                <ext:RecordField Name="ToChucID" Type="Int" />
                                <ext:RecordField Name="TenToChucShort" Type="String" />
                                <ext:RecordField Name="TenToChucFull" Type="String" />
                                <ext:RecordField Name="ToChucIDCha" Type="Int" />
                                <ext:RecordField Name="ToChucLevel" Type="Int" />
                                <ext:RecordField Name="XepHangDonViID" Type="Int" />
                                <ext:RecordField Name="KhoiQuanLyID" Type="Int" />
                                <ext:RecordField Name="DiaChiID" Type="Int" />
                                <ext:RecordField Name="DonViHanhChinhTruocThuocID" Type="Int" />
                                <ext:RecordField Name="LoaiToChucID" Type="Int" />
                                <ext:RecordField Name="GhiChu" Type="String" />
                            </Fields>
                        </ext:JsonReader>
                    </Reader>
                    <DirectEventConfig IsUpload="true" />
                </ext:Store>
            </Store>
            <TopBar>
                <ext:Toolbar ID="FunctionToolbar" runat="server" LabelAlign="Right" >
                    <Items>
                        <ext:Button ID="btnAddNew" runat="server" Text="Tạo mới" IconAlign="Left" Icon="Add">
                            <Listeners>
                            </Listeners>
                            <DirectEvents>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarFill />
                        <ext:Button ID="btnExportXML" runat="server" Text="Xuất XML" Icon="PageCode">
                            <Listeners>
                                <Click Handler="submitValue(#{GrdDetails}, #{FormatType}, 'xml');" />
                            </Listeners>
                        </ext:Button>
                        <ext:Button ID="btnExportExcel" runat="server" Text="Xuất Excel" Icon="PageExcel">
                            <Listeners>
                                <Click Handler="submitValue(#{GrdDetails}, #{FormatType}, 'xls');" />
                            </Listeners>
                        </ext:Button>
                        <ext:Button ID="btnExportCSV" runat="server" Text="Xuất CSV" Icon="PageAttach">
                            <Listeners>
                                <Click Handler="submitValue(#{GrdDetails}, #{FormatType}, 'csv');" />
                            </Listeners>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbarList" runat="server" PageIndex="1" PageSize="20">
                </ext:PagingToolbar>
            </BottomBar>
            <SelectionModel>
                <ext:CheckboxSelectionModel ID="GridCheckboxSelectionModel" runat="server" SingleSelect="true" />
            </SelectionModel>
            <LoadMask ShowMask="true" />
            <Listeners>
                <Command Handler="#{DirectMethods}.ShowDetail(record.id,command);" />
            </Listeners>
            <DirectEvents>
                
            </DirectEvents>
        </ext:GridPanel>
    </Items>
</ext:FitLayout>
